{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DAY3（数据框DataFrame上）\n",
    "\n",
    "- 如何创建df\n",
    "- df基操\n",
    "\n",
    "`pandas.DataFrame( data, index, columns, dtype, copy)`\n",
    "\n",
    "DataFrame 是一个表格型的数据结构，它含有一组有序的列，每列可以是不同的值类型（数值、字符串、布尔型值）。DataFrame 既有行索引也有列索引，它可以被看做由 Series 组成的字典（共同用一个索引）。\n",
    "就当做excel的sheet或者sql的table来看就好，有行有列，也是最常见的数据结构！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = [['A',10],\n",
    "        ['B',12],\n",
    "        ['C',13]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>第一列</th>\n",
       "      <th>第二列</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>第一行</th>\n",
       "      <td>A</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>第二行</th>\n",
       "      <td>B</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>第三行</th>\n",
       "      <td>C</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    第一列  第二列\n",
       "第一行   A   10\n",
       "第二行   B   12\n",
       "第三行   C   13"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = [['A',10],['B',12],['C',13]]\n",
    "# 这里的['A',10]代表每一行的内容，共有三行\n",
    "df = pd.DataFrame(data,\n",
    "                  columns=['第一列','第二列'], \n",
    "                  index = ['第一行','第二行','第三行'])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[11, 22, 33],\n",
       "       [44, 55, 66]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.array([[11,22,33],[44,55,66]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>11</td>\n",
       "      <td>22</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>44</td>\n",
       "      <td>55</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    0   1   2\n",
       "0  11  22  33\n",
       "1  44  55  66"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.array([[11,22,33],[44,55,66]])\n",
    "df = pd.DataFrame(data)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = {'名字':['小张','小王','小李','小赵'],\n",
    "        '年龄':[23,22,21,24]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>名字</th>\n",
       "      <th>年龄</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>小张</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>小王</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>小李</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>小赵</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   名字  年龄\n",
       "0  小张  23\n",
       "1  小王  22\n",
       "2  小李  21\n",
       "3  小赵  24"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = {'名字':['小张','小王','小李','小赵'],\n",
    "        '年龄':[23,22,21,24]}\n",
    "df=pd.DataFrame(data)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.204847</td>\n",
       "      <td>1.362250</td>\n",
       "      <td>2.248861</td>\n",
       "      <td>-0.087904</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.195379</td>\n",
       "      <td>-0.728094</td>\n",
       "      <td>0.405476</td>\n",
       "      <td>0.096266</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.612209</td>\n",
       "      <td>-1.912672</td>\n",
       "      <td>-1.764975</td>\n",
       "      <td>-0.307226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.008886</td>\n",
       "      <td>-0.729317</td>\n",
       "      <td>-0.309159</td>\n",
       "      <td>-0.404772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.506621</td>\n",
       "      <td>0.815165</td>\n",
       "      <td>-0.535957</td>\n",
       "      <td>0.126149</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>0.745685</td>\n",
       "      <td>-0.551097</td>\n",
       "      <td>0.813275</td>\n",
       "      <td>0.650597</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>-0.656548</td>\n",
       "      <td>0.518599</td>\n",
       "      <td>0.391767</td>\n",
       "      <td>-0.432524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>-0.520914</td>\n",
       "      <td>1.601559</td>\n",
       "      <td>1.306306</td>\n",
       "      <td>0.299631</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.348073</td>\n",
       "      <td>1.852337</td>\n",
       "      <td>-0.130801</td>\n",
       "      <td>1.720337</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>0.522563</td>\n",
       "      <td>-1.771250</td>\n",
       "      <td>0.891338</td>\n",
       "      <td>0.833723</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           A         B         C         D\n",
       "0  -0.204847  1.362250  2.248861 -0.087904\n",
       "1  -0.195379 -0.728094  0.405476  0.096266\n",
       "2  -1.612209 -1.912672 -1.764975 -0.307226\n",
       "3  -0.008886 -0.729317 -0.309159 -0.404772\n",
       "4  -0.506621  0.815165 -0.535957  0.126149\n",
       "..       ...       ...       ...       ...\n",
       "95  0.745685 -0.551097  0.813275  0.650597\n",
       "96 -0.656548  0.518599  0.391767 -0.432524\n",
       "97 -0.520914  1.601559  1.306306  0.299631\n",
       "98  0.348073  1.852337 -0.130801  1.720337\n",
       "99  0.522563 -1.771250  0.891338  0.833723\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.randn(100,4), columns=list('ABCD'))\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "      <th>E</th>\n",
       "      <th>F</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2013-01-02</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3</td>\n",
       "      <td>test</td>\n",
       "      <td>foo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2013-01-02</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>train</td>\n",
       "      <td>foo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2013-01-02</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>test</td>\n",
       "      <td>foo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2013-01-02</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3</td>\n",
       "      <td>train</td>\n",
       "      <td>foo</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     A          B    C  D      E    F\n",
       "0  1.0 2013-01-02  1.0  3   test  foo\n",
       "1  1.0 2013-01-02  2.0  3  train  foo\n",
       "2  1.0 2013-01-02  3.0  3   test  foo\n",
       "3  1.0 2013-01-02  4.0  3  train  foo"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({  'A' : 1.,    \n",
    "                     # 使用1.代表1.0，用一个浮点数填充整个列\n",
    "                     'B' : pd.Timestamp('20130102'),\n",
    "                     # 用时间戳填充整个列\n",
    "                     'C' : pd.Series([1,2,3,4],index=list(range(4)),dtype='float32'),\n",
    "                     # 用系列\n",
    "                     'D' : np.array([3]*4,dtype='int32'),\n",
    "                     # 用数组\n",
    "                     'E' : pd.Categorical([\"test\",\"train\",\"test\",\"train\"]),\n",
    "                     # 转换为类别变量\n",
    "                     'F' : 'foo' })\n",
    "                     # 字符填充\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.184678</td>\n",
       "      <td>0.175040</td>\n",
       "      <td>-2.134440</td>\n",
       "      <td>0.109561</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.420003</td>\n",
       "      <td>0.131141</td>\n",
       "      <td>-1.357080</td>\n",
       "      <td>-0.848362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.805069</td>\n",
       "      <td>0.198811</td>\n",
       "      <td>1.129412</td>\n",
       "      <td>-0.905888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.844412</td>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.770718</td>\n",
       "      <td>1.042945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.119666</td>\n",
       "      <td>-0.254929</td>\n",
       "      <td>0.337672</td>\n",
       "      <td>0.689507</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>0.723530</td>\n",
       "      <td>-0.159281</td>\n",
       "      <td>-1.438188</td>\n",
       "      <td>-0.608657</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.467257</td>\n",
       "      <td>0.402648</td>\n",
       "      <td>-0.452367</td>\n",
       "      <td>0.347611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>1.591035</td>\n",
       "      <td>-0.818421</td>\n",
       "      <td>-0.157088</td>\n",
       "      <td>1.496493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.531323</td>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.366143</td>\n",
       "      <td>0.012103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.422232</td>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.013829</td>\n",
       "      <td>1.950344</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           A         B         C         D\n",
       "0  -0.184678  0.175040 -2.134440  0.109561\n",
       "1   0.420003  0.131141 -1.357080 -0.848362\n",
       "2  -0.805069  0.198811  1.129412 -0.905888\n",
       "3   0.844412  1.611422  0.770718  1.042945\n",
       "4   1.119666 -0.254929  0.337672  0.689507\n",
       "..       ...       ...       ...       ...\n",
       "95  0.723530 -0.159281 -1.438188 -0.608657\n",
       "96  0.467257  0.402648 -0.452367  0.347611\n",
       "97  1.591035 -0.818421 -0.157088  1.496493\n",
       "98  0.531323 -1.195636  0.366143  0.012103\n",
       "99 -1.422232 -0.266266 -1.013829  1.950344\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.randn(100,4), columns=list('ABCD'))\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.184678</td>\n",
       "      <td>0.175040</td>\n",
       "      <td>-2.134440</td>\n",
       "      <td>0.109561</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.420003</td>\n",
       "      <td>0.131141</td>\n",
       "      <td>-1.357080</td>\n",
       "      <td>-0.848362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.805069</td>\n",
       "      <td>0.198811</td>\n",
       "      <td>1.129412</td>\n",
       "      <td>-0.905888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.844412</td>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.770718</td>\n",
       "      <td>1.042945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.119666</td>\n",
       "      <td>-0.254929</td>\n",
       "      <td>0.337672</td>\n",
       "      <td>0.689507</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          A         B         C         D\n",
       "0 -0.184678  0.175040 -2.134440  0.109561\n",
       "1  0.420003  0.131141 -1.357080 -0.848362\n",
       "2 -0.805069  0.198811  1.129412 -0.905888\n",
       "3  0.844412  1.611422  0.770718  1.042945\n",
       "4  1.119666 -0.254929  0.337672  0.689507"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>0.723530</td>\n",
       "      <td>-0.159281</td>\n",
       "      <td>-1.438188</td>\n",
       "      <td>-0.608657</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.467257</td>\n",
       "      <td>0.402648</td>\n",
       "      <td>-0.452367</td>\n",
       "      <td>0.347611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>1.591035</td>\n",
       "      <td>-0.818421</td>\n",
       "      <td>-0.157088</td>\n",
       "      <td>1.496493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.531323</td>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.366143</td>\n",
       "      <td>0.012103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.422232</td>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.013829</td>\n",
       "      <td>1.950344</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           A         B         C         D\n",
       "95  0.723530 -0.159281 -1.438188 -0.608657\n",
       "96  0.467257  0.402648 -0.452367  0.347611\n",
       "97  1.591035 -0.818421 -0.157088  1.496493\n",
       "98  0.531323 -1.195636  0.366143  0.012103\n",
       "99 -1.422232 -0.266266 -1.013829  1.950344"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=100, step=1)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['A', 'B', 'C', 'D'], dtype='object')"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.1846782 ,  0.17504031, -2.13443962,  0.10956133],\n",
       "       [ 0.42000296,  0.13114138, -1.35708034, -0.84836186],\n",
       "       [-0.80506857,  0.19881119,  1.12941227, -0.90588767],\n",
       "       [ 0.84441191,  1.61142212,  0.77071758,  1.04294477],\n",
       "       [ 1.11966583, -0.25492858,  0.33767203,  0.68950682],\n",
       "       [-0.8976088 ,  0.53921029, -0.37457423,  0.25400787],\n",
       "       [ 0.31006012,  0.24562097,  0.15598879,  0.15507496],\n",
       "       [-1.35200891,  0.33864734,  0.67898918, -0.93727709],\n",
       "       [-0.62126171, -1.08528866, -0.53367878,  1.25211957],\n",
       "       [-1.47734895,  0.57108262, -0.94574833,  0.41116438],\n",
       "       [ 0.59491172, -0.14780226, -0.8149876 ,  1.79697142],\n",
       "       [-1.13645422, -0.9291553 ,  1.50607583,  0.69386617],\n",
       "       [-0.89577791,  0.4280865 , -0.73850251, -0.01182225],\n",
       "       [ 1.03326161, -0.18138849,  0.58876247,  0.41089651],\n",
       "       [ 0.62663578, -0.87620017,  1.35265256, -0.67992183],\n",
       "       [ 0.22065831,  0.60538854,  1.63509301, -0.5838637 ],\n",
       "       [ 0.25678209,  0.89375787,  2.73382136,  1.3114465 ],\n",
       "       [ 0.4800041 ,  0.14169051,  1.10314833,  0.45176899],\n",
       "       [-0.48746919, -0.77370736, -0.41425454, -0.67034121],\n",
       "       [ 0.57898294,  0.97259753, -0.09533936,  0.79228432],\n",
       "       [ 0.06204646,  0.40088658, -1.84622642, -1.73440989],\n",
       "       [-1.17620324, -1.48866459,  0.43838321,  1.55041357],\n",
       "       [-1.12070871, -0.01219721,  0.69602989,  2.03736662],\n",
       "       [-0.15349969, -0.37888095, -0.23256199,  0.99153958],\n",
       "       [-0.34203875, -1.29059391,  0.0946559 ,  0.44365156],\n",
       "       [ 0.65589158,  0.10118827, -0.90925409, -0.20218574],\n",
       "       [-0.87346512,  0.26726272, -1.26998791,  0.85513897],\n",
       "       [ 0.20053682, -0.08788431,  0.02770237,  0.04902182],\n",
       "       [-0.12191428, -0.60311409,  0.61086392, -0.30769355],\n",
       "       [ 1.74497825, -0.49310433, -0.99488963,  1.4376518 ],\n",
       "       [-0.56475627,  0.78529104, -0.55058163, -1.34170226],\n",
       "       [-2.16483882,  0.15702333, -1.05388313,  0.13432693],\n",
       "       [ 1.91803991,  0.85910752, -0.5681023 ,  0.28604715],\n",
       "       [-0.13516973, -0.56987385, -0.35749598, -2.10729569],\n",
       "       [ 2.5845421 ,  1.57066542,  1.02450361,  0.90706108],\n",
       "       [-1.35533908, -0.16881044, -0.21741722,  1.89611468],\n",
       "       [ 0.03998748, -2.15818171,  0.6488777 , -0.15688568],\n",
       "       [ 0.06816275,  0.94980052,  0.63314201,  2.55471403],\n",
       "       [ 1.60117413,  1.31974336, -1.2438418 , -0.45185279],\n",
       "       [ 0.9717524 , -0.84826215,  0.19466746,  1.29269765],\n",
       "       [-1.1822841 ,  1.19669052, -0.41437174, -0.64552128],\n",
       "       [ 1.22663156,  0.0846639 , -0.285231  , -1.80872788],\n",
       "       [ 0.71588154, -1.55819099,  0.4227093 ,  0.50995204],\n",
       "       [-1.68613689,  0.13867392,  0.80365516,  0.06506159],\n",
       "       [ 0.12065451,  1.27280246,  0.13798653,  1.27378242],\n",
       "       [-0.65460214,  2.01071313, -1.16507837, -1.68734391],\n",
       "       [-0.05906437, -0.1722213 , -1.07321825, -0.30975984],\n",
       "       [ 0.63173155, -2.59769817, -0.75186108,  0.9847449 ],\n",
       "       [ 0.22215954, -0.85683385,  0.88164716,  1.71923963],\n",
       "       [ 1.02280576, -0.13570826,  0.50151442,  3.10970589],\n",
       "       [ 0.79566482, -0.19579647, -1.34224967, -0.06790779],\n",
       "       [ 1.7373864 , -0.16644327, -0.77436497,  0.41289267],\n",
       "       [-1.44489706, -0.31357283, -1.19565295, -0.56800929],\n",
       "       [ 1.4189341 , -0.87844883,  0.21400447,  1.08603388],\n",
       "       [ 0.4402205 , -1.46436912,  0.47709368,  0.41914121],\n",
       "       [-0.6368579 , -1.06562142, -0.5006074 , -1.03273622],\n",
       "       [-2.17541626, -0.13691299, -0.79451175, -0.40045733],\n",
       "       [-0.41860031, -1.19268334,  1.18404806, -0.56973377],\n",
       "       [-0.50719075,  1.18969133, -0.3446889 ,  1.35658822],\n",
       "       [ 0.01034528,  0.66249374, -0.75397605, -0.33516576],\n",
       "       [ 0.8814501 , -1.384909  ,  0.65174927, -0.25457113],\n",
       "       [ 0.4567276 , -0.15408406, -0.36307576, -0.36832389],\n",
       "       [ 2.07557714, -0.85389086, -0.17682516, -0.25147878],\n",
       "       [-0.01242881,  0.01161713,  0.34379186,  0.96106636],\n",
       "       [ 0.8955956 , -0.79013488,  0.11518492,  0.06793832],\n",
       "       [ 1.31188701, -1.4639745 ,  0.96876967,  1.02468065],\n",
       "       [ 1.13052233,  1.01307562,  0.04756393,  1.45047207],\n",
       "       [ 0.37473805, -1.01625886,  0.87699697, -0.37031174],\n",
       "       [ 1.90246084, -0.80759618,  1.66405419, -1.71212559],\n",
       "       [ 0.19543088, -1.3004691 ,  1.26277136,  0.08654721],\n",
       "       [-0.08150656,  0.96709835,  0.90431081, -0.52230006],\n",
       "       [ 1.25502258, -0.37313758,  0.80827632, -0.57801287],\n",
       "       [-1.69929818,  0.20384814, -0.86092982,  0.12403367],\n",
       "       [ 0.48863066,  0.16899963, -0.45602762, -0.93351673],\n",
       "       [-2.16958881, -1.11297052,  1.29522238, -1.28476623],\n",
       "       [-0.18909712, -0.9249087 ,  1.60070675, -0.75948419],\n",
       "       [-0.59387377,  1.14436941,  0.54103865, -2.2821082 ],\n",
       "       [-1.81813247,  1.40022836, -0.98738623,  0.24334   ],\n",
       "       [-0.16359349,  0.27819684, -0.106089  , -0.78751342],\n",
       "       [-1.17564225,  0.92738116, -0.58313247, -0.00732454],\n",
       "       [ 1.32685386,  0.68123815,  0.45494052,  0.27330631],\n",
       "       [-0.53824148,  0.28357909,  1.45953886,  0.20560071],\n",
       "       [-1.56257422,  0.85604044,  0.26667178,  0.37452054],\n",
       "       [ 1.67601348,  0.54530094,  0.307228  ,  0.09579052],\n",
       "       [-2.80708077,  0.35534865,  0.48802292,  0.96462802],\n",
       "       [ 0.9031697 ,  0.3239642 , -0.33943711, -0.55004604],\n",
       "       [ 0.9118411 ,  0.15596667, -0.19361918,  0.73325036],\n",
       "       [-0.54271261, -1.25157797,  0.38299001,  0.69485755],\n",
       "       [ 2.10552352,  0.17861042,  1.2367673 ,  1.83766837],\n",
       "       [-1.99261092, -0.06158397, -0.77014958, -0.82530765],\n",
       "       [ 2.76405671, -1.66354552, -1.06250104,  0.86642229],\n",
       "       [-0.40303905, -0.0311004 , -0.46789775, -2.447925  ],\n",
       "       [-1.00099137,  1.55977299,  0.40780534, -0.19063426],\n",
       "       [-1.82682551, -0.59286115,  0.29026156, -2.11728809],\n",
       "       [-1.83687796, -0.12238735, -1.52779875,  1.39039554],\n",
       "       [ 0.72353004, -0.15928064, -1.43818826, -0.60865741],\n",
       "       [ 0.46725744,  0.40264777, -0.45236673,  0.34761132],\n",
       "       [ 1.59103474, -0.81842084, -0.15708824,  1.49649267],\n",
       "       [ 0.53132279, -1.19563629,  0.36614313,  0.01210322],\n",
       "       [-1.42223225, -0.26626562, -1.01382874,  1.95034376]])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.1846782 ,  0.17504031, -2.13443962,  0.10956133],\n",
       "       [ 0.42000296,  0.13114138, -1.35708034, -0.84836186],\n",
       "       [-0.80506857,  0.19881119,  1.12941227, -0.90588767],\n",
       "       [ 0.84441191,  1.61142212,  0.77071758,  1.04294477],\n",
       "       [ 1.11966583, -0.25492858,  0.33767203,  0.68950682],\n",
       "       [-0.8976088 ,  0.53921029, -0.37457423,  0.25400787],\n",
       "       [ 0.31006012,  0.24562097,  0.15598879,  0.15507496],\n",
       "       [-1.35200891,  0.33864734,  0.67898918, -0.93727709],\n",
       "       [-0.62126171, -1.08528866, -0.53367878,  1.25211957],\n",
       "       [-1.47734895,  0.57108262, -0.94574833,  0.41116438],\n",
       "       [ 0.59491172, -0.14780226, -0.8149876 ,  1.79697142],\n",
       "       [-1.13645422, -0.9291553 ,  1.50607583,  0.69386617],\n",
       "       [-0.89577791,  0.4280865 , -0.73850251, -0.01182225],\n",
       "       [ 1.03326161, -0.18138849,  0.58876247,  0.41089651],\n",
       "       [ 0.62663578, -0.87620017,  1.35265256, -0.67992183],\n",
       "       [ 0.22065831,  0.60538854,  1.63509301, -0.5838637 ],\n",
       "       [ 0.25678209,  0.89375787,  2.73382136,  1.3114465 ],\n",
       "       [ 0.4800041 ,  0.14169051,  1.10314833,  0.45176899],\n",
       "       [-0.48746919, -0.77370736, -0.41425454, -0.67034121],\n",
       "       [ 0.57898294,  0.97259753, -0.09533936,  0.79228432],\n",
       "       [ 0.06204646,  0.40088658, -1.84622642, -1.73440989],\n",
       "       [-1.17620324, -1.48866459,  0.43838321,  1.55041357],\n",
       "       [-1.12070871, -0.01219721,  0.69602989,  2.03736662],\n",
       "       [-0.15349969, -0.37888095, -0.23256199,  0.99153958],\n",
       "       [-0.34203875, -1.29059391,  0.0946559 ,  0.44365156],\n",
       "       [ 0.65589158,  0.10118827, -0.90925409, -0.20218574],\n",
       "       [-0.87346512,  0.26726272, -1.26998791,  0.85513897],\n",
       "       [ 0.20053682, -0.08788431,  0.02770237,  0.04902182],\n",
       "       [-0.12191428, -0.60311409,  0.61086392, -0.30769355],\n",
       "       [ 1.74497825, -0.49310433, -0.99488963,  1.4376518 ],\n",
       "       [-0.56475627,  0.78529104, -0.55058163, -1.34170226],\n",
       "       [-2.16483882,  0.15702333, -1.05388313,  0.13432693],\n",
       "       [ 1.91803991,  0.85910752, -0.5681023 ,  0.28604715],\n",
       "       [-0.13516973, -0.56987385, -0.35749598, -2.10729569],\n",
       "       [ 2.5845421 ,  1.57066542,  1.02450361,  0.90706108],\n",
       "       [-1.35533908, -0.16881044, -0.21741722,  1.89611468],\n",
       "       [ 0.03998748, -2.15818171,  0.6488777 , -0.15688568],\n",
       "       [ 0.06816275,  0.94980052,  0.63314201,  2.55471403],\n",
       "       [ 1.60117413,  1.31974336, -1.2438418 , -0.45185279],\n",
       "       [ 0.9717524 , -0.84826215,  0.19466746,  1.29269765],\n",
       "       [-1.1822841 ,  1.19669052, -0.41437174, -0.64552128],\n",
       "       [ 1.22663156,  0.0846639 , -0.285231  , -1.80872788],\n",
       "       [ 0.71588154, -1.55819099,  0.4227093 ,  0.50995204],\n",
       "       [-1.68613689,  0.13867392,  0.80365516,  0.06506159],\n",
       "       [ 0.12065451,  1.27280246,  0.13798653,  1.27378242],\n",
       "       [-0.65460214,  2.01071313, -1.16507837, -1.68734391],\n",
       "       [-0.05906437, -0.1722213 , -1.07321825, -0.30975984],\n",
       "       [ 0.63173155, -2.59769817, -0.75186108,  0.9847449 ],\n",
       "       [ 0.22215954, -0.85683385,  0.88164716,  1.71923963],\n",
       "       [ 1.02280576, -0.13570826,  0.50151442,  3.10970589],\n",
       "       [ 0.79566482, -0.19579647, -1.34224967, -0.06790779],\n",
       "       [ 1.7373864 , -0.16644327, -0.77436497,  0.41289267],\n",
       "       [-1.44489706, -0.31357283, -1.19565295, -0.56800929],\n",
       "       [ 1.4189341 , -0.87844883,  0.21400447,  1.08603388],\n",
       "       [ 0.4402205 , -1.46436912,  0.47709368,  0.41914121],\n",
       "       [-0.6368579 , -1.06562142, -0.5006074 , -1.03273622],\n",
       "       [-2.17541626, -0.13691299, -0.79451175, -0.40045733],\n",
       "       [-0.41860031, -1.19268334,  1.18404806, -0.56973377],\n",
       "       [-0.50719075,  1.18969133, -0.3446889 ,  1.35658822],\n",
       "       [ 0.01034528,  0.66249374, -0.75397605, -0.33516576],\n",
       "       [ 0.8814501 , -1.384909  ,  0.65174927, -0.25457113],\n",
       "       [ 0.4567276 , -0.15408406, -0.36307576, -0.36832389],\n",
       "       [ 2.07557714, -0.85389086, -0.17682516, -0.25147878],\n",
       "       [-0.01242881,  0.01161713,  0.34379186,  0.96106636],\n",
       "       [ 0.8955956 , -0.79013488,  0.11518492,  0.06793832],\n",
       "       [ 1.31188701, -1.4639745 ,  0.96876967,  1.02468065],\n",
       "       [ 1.13052233,  1.01307562,  0.04756393,  1.45047207],\n",
       "       [ 0.37473805, -1.01625886,  0.87699697, -0.37031174],\n",
       "       [ 1.90246084, -0.80759618,  1.66405419, -1.71212559],\n",
       "       [ 0.19543088, -1.3004691 ,  1.26277136,  0.08654721],\n",
       "       [-0.08150656,  0.96709835,  0.90431081, -0.52230006],\n",
       "       [ 1.25502258, -0.37313758,  0.80827632, -0.57801287],\n",
       "       [-1.69929818,  0.20384814, -0.86092982,  0.12403367],\n",
       "       [ 0.48863066,  0.16899963, -0.45602762, -0.93351673],\n",
       "       [-2.16958881, -1.11297052,  1.29522238, -1.28476623],\n",
       "       [-0.18909712, -0.9249087 ,  1.60070675, -0.75948419],\n",
       "       [-0.59387377,  1.14436941,  0.54103865, -2.2821082 ],\n",
       "       [-1.81813247,  1.40022836, -0.98738623,  0.24334   ],\n",
       "       [-0.16359349,  0.27819684, -0.106089  , -0.78751342],\n",
       "       [-1.17564225,  0.92738116, -0.58313247, -0.00732454],\n",
       "       [ 1.32685386,  0.68123815,  0.45494052,  0.27330631],\n",
       "       [-0.53824148,  0.28357909,  1.45953886,  0.20560071],\n",
       "       [-1.56257422,  0.85604044,  0.26667178,  0.37452054],\n",
       "       [ 1.67601348,  0.54530094,  0.307228  ,  0.09579052],\n",
       "       [-2.80708077,  0.35534865,  0.48802292,  0.96462802],\n",
       "       [ 0.9031697 ,  0.3239642 , -0.33943711, -0.55004604],\n",
       "       [ 0.9118411 ,  0.15596667, -0.19361918,  0.73325036],\n",
       "       [-0.54271261, -1.25157797,  0.38299001,  0.69485755],\n",
       "       [ 2.10552352,  0.17861042,  1.2367673 ,  1.83766837],\n",
       "       [-1.99261092, -0.06158397, -0.77014958, -0.82530765],\n",
       "       [ 2.76405671, -1.66354552, -1.06250104,  0.86642229],\n",
       "       [-0.40303905, -0.0311004 , -0.46789775, -2.447925  ],\n",
       "       [-1.00099137,  1.55977299,  0.40780534, -0.19063426],\n",
       "       [-1.82682551, -0.59286115,  0.29026156, -2.11728809],\n",
       "       [-1.83687796, -0.12238735, -1.52779875,  1.39039554],\n",
       "       [ 0.72353004, -0.15928064, -1.43818826, -0.60865741],\n",
       "       [ 0.46725744,  0.40264777, -0.45236673,  0.34761132],\n",
       "       [ 1.59103474, -0.81842084, -0.15708824,  1.49649267],\n",
       "       [ 0.53132279, -1.19563629,  0.36614313,  0.01210322],\n",
       "       [-1.42223225, -0.26626562, -1.01382874,  1.95034376]])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_numpy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>100.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>-0.037357</td>\n",
       "      <td>-0.156330</td>\n",
       "      <td>-0.048157</td>\n",
       "      <td>0.004772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.169692</td>\n",
       "      <td>1.092030</td>\n",
       "      <td>1.059902</td>\n",
       "      <td>0.976548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-2.910543</td>\n",
       "      <td>-2.642297</td>\n",
       "      <td>-2.519962</td>\n",
       "      <td>-1.983765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.913198</td>\n",
       "      <td>-0.685573</td>\n",
       "      <td>-0.648775</td>\n",
       "      <td>-0.595886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-0.098147</td>\n",
       "      <td>-0.219149</td>\n",
       "      <td>-0.047594</td>\n",
       "      <td>0.013169</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.695333</td>\n",
       "      <td>0.474067</td>\n",
       "      <td>0.578417</td>\n",
       "      <td>0.562648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>3.479813</td>\n",
       "      <td>3.356829</td>\n",
       "      <td>3.116607</td>\n",
       "      <td>2.635545</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                A           B           C           D\n",
       "count  100.000000  100.000000  100.000000  100.000000\n",
       "mean    -0.037357   -0.156330   -0.048157    0.004772\n",
       "std      1.169692    1.092030    1.059902    0.976548\n",
       "min     -2.910543   -2.642297   -2.519962   -1.983765\n",
       "25%     -0.913198   -0.685573   -0.648775   -0.595886\n",
       "50%     -0.098147   -0.219149   -0.047594    0.013169\n",
       "75%      0.695333    0.474067    0.578417    0.562648\n",
       "max      3.479813    3.356829    3.116607    2.635545"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>90</th>\n",
       "      <th>91</th>\n",
       "      <th>92</th>\n",
       "      <th>93</th>\n",
       "      <th>94</th>\n",
       "      <th>95</th>\n",
       "      <th>96</th>\n",
       "      <th>97</th>\n",
       "      <th>98</th>\n",
       "      <th>99</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <td>2.119025</td>\n",
       "      <td>2.163053</td>\n",
       "      <td>0.608507</td>\n",
       "      <td>-0.805249</td>\n",
       "      <td>-0.977325</td>\n",
       "      <td>-0.105672</td>\n",
       "      <td>0.799635</td>\n",
       "      <td>1.004797</td>\n",
       "      <td>-2.910543</td>\n",
       "      <td>0.092668</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.138247</td>\n",
       "      <td>-0.892953</td>\n",
       "      <td>0.726396</td>\n",
       "      <td>-2.067440</td>\n",
       "      <td>0.243256</td>\n",
       "      <td>-1.534976</td>\n",
       "      <td>-0.764858</td>\n",
       "      <td>0.490673</td>\n",
       "      <td>-0.728555</td>\n",
       "      <td>0.165681</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>-0.639141</td>\n",
       "      <td>-0.972635</td>\n",
       "      <td>0.185513</td>\n",
       "      <td>-2.216506</td>\n",
       "      <td>-0.250679</td>\n",
       "      <td>0.187289</td>\n",
       "      <td>-0.005181</td>\n",
       "      <td>-0.120574</td>\n",
       "      <td>-0.464356</td>\n",
       "      <td>-0.217452</td>\n",
       "      <td>...</td>\n",
       "      <td>0.986711</td>\n",
       "      <td>-0.938321</td>\n",
       "      <td>0.537291</td>\n",
       "      <td>-1.271665</td>\n",
       "      <td>0.706547</td>\n",
       "      <td>0.472669</td>\n",
       "      <td>-0.261254</td>\n",
       "      <td>-0.672964</td>\n",
       "      <td>-0.002539</td>\n",
       "      <td>-1.582530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>0.239870</td>\n",
       "      <td>0.356271</td>\n",
       "      <td>-1.070570</td>\n",
       "      <td>0.237003</td>\n",
       "      <td>-0.349436</td>\n",
       "      <td>-0.589115</td>\n",
       "      <td>2.904038</td>\n",
       "      <td>-1.652211</td>\n",
       "      <td>-0.253875</td>\n",
       "      <td>-0.800411</td>\n",
       "      <td>...</td>\n",
       "      <td>0.305644</td>\n",
       "      <td>1.572707</td>\n",
       "      <td>-0.935663</td>\n",
       "      <td>-1.113595</td>\n",
       "      <td>0.298259</td>\n",
       "      <td>-0.078407</td>\n",
       "      <td>0.854734</td>\n",
       "      <td>-0.697727</td>\n",
       "      <td>0.167988</td>\n",
       "      <td>1.065394</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>D</th>\n",
       "      <td>-0.051092</td>\n",
       "      <td>-0.057491</td>\n",
       "      <td>1.007069</td>\n",
       "      <td>-0.292817</td>\n",
       "      <td>-0.494257</td>\n",
       "      <td>0.419766</td>\n",
       "      <td>-1.217387</td>\n",
       "      <td>-1.210724</td>\n",
       "      <td>1.301783</td>\n",
       "      <td>2.101312</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.462965</td>\n",
       "      <td>0.589362</td>\n",
       "      <td>-0.537173</td>\n",
       "      <td>-1.929711</td>\n",
       "      <td>1.129605</td>\n",
       "      <td>-1.236833</td>\n",
       "      <td>-0.577687</td>\n",
       "      <td>0.502411</td>\n",
       "      <td>1.078904</td>\n",
       "      <td>1.049249</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>4 rows × 100 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         0         1         2         3         4         5         6   \\\n",
       "A  2.119025  2.163053  0.608507 -0.805249 -0.977325 -0.105672  0.799635   \n",
       "B -0.639141 -0.972635  0.185513 -2.216506 -0.250679  0.187289 -0.005181   \n",
       "C  0.239870  0.356271 -1.070570  0.237003 -0.349436 -0.589115  2.904038   \n",
       "D -0.051092 -0.057491  1.007069 -0.292817 -0.494257  0.419766 -1.217387   \n",
       "\n",
       "         7         8         9   ...        90        91        92        93  \\\n",
       "A  1.004797 -2.910543  0.092668  ... -1.138247 -0.892953  0.726396 -2.067440   \n",
       "B -0.120574 -0.464356 -0.217452  ...  0.986711 -0.938321  0.537291 -1.271665   \n",
       "C -1.652211 -0.253875 -0.800411  ...  0.305644  1.572707 -0.935663 -1.113595   \n",
       "D -1.210724  1.301783  2.101312  ... -1.462965  0.589362 -0.537173 -1.929711   \n",
       "\n",
       "         94        95        96        97        98        99  \n",
       "A  0.243256 -1.534976 -0.764858  0.490673 -0.728555  0.165681  \n",
       "B  0.706547  0.472669 -0.261254 -0.672964 -0.002539 -1.582530  \n",
       "C  0.298259 -0.078407  0.854734 -0.697727  0.167988  1.065394  \n",
       "D  1.129605 -1.236833 -0.577687  0.502411  1.078904  1.049249  \n",
       "\n",
       "[4 rows x 100 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.columns = ['a','B','c','D']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>a</th>\n",
       "      <th>B</th>\n",
       "      <th>c</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.184678</td>\n",
       "      <td>0.175040</td>\n",
       "      <td>-2.134440</td>\n",
       "      <td>0.109561</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.420003</td>\n",
       "      <td>0.131141</td>\n",
       "      <td>-1.357080</td>\n",
       "      <td>-0.848362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.805069</td>\n",
       "      <td>0.198811</td>\n",
       "      <td>1.129412</td>\n",
       "      <td>-0.905888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.844412</td>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.770718</td>\n",
       "      <td>1.042945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.119666</td>\n",
       "      <td>-0.254929</td>\n",
       "      <td>0.337672</td>\n",
       "      <td>0.689507</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>0.723530</td>\n",
       "      <td>-0.159281</td>\n",
       "      <td>-1.438188</td>\n",
       "      <td>-0.608657</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.467257</td>\n",
       "      <td>0.402648</td>\n",
       "      <td>-0.452367</td>\n",
       "      <td>0.347611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>1.591035</td>\n",
       "      <td>-0.818421</td>\n",
       "      <td>-0.157088</td>\n",
       "      <td>1.496493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.531323</td>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.366143</td>\n",
       "      <td>0.012103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.422232</td>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.013829</td>\n",
       "      <td>1.950344</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           a         B         c         D\n",
       "0  -0.184678  0.175040 -2.134440  0.109561\n",
       "1   0.420003  0.131141 -1.357080 -0.848362\n",
       "2  -0.805069  0.198811  1.129412 -0.905888\n",
       "3   0.844412  1.611422  0.770718  1.042945\n",
       "4   1.119666 -0.254929  0.337672  0.689507\n",
       "..       ...       ...       ...       ...\n",
       "95  0.723530 -0.159281 -1.438188 -0.608657\n",
       "96  0.467257  0.402648 -0.452367  0.347611\n",
       "97  1.591035 -0.818421 -0.157088  1.496493\n",
       "98  0.531323 -1.195636  0.366143  0.012103\n",
       "99 -1.422232 -0.266266 -1.013829  1.950344\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>D</th>\n",
       "      <th>c</th>\n",
       "      <th>B</th>\n",
       "      <th>a</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.109561</td>\n",
       "      <td>-2.134440</td>\n",
       "      <td>0.175040</td>\n",
       "      <td>-0.184678</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.848362</td>\n",
       "      <td>-1.357080</td>\n",
       "      <td>0.131141</td>\n",
       "      <td>0.420003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.905888</td>\n",
       "      <td>1.129412</td>\n",
       "      <td>0.198811</td>\n",
       "      <td>-0.805069</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.042945</td>\n",
       "      <td>0.770718</td>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.844412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.689507</td>\n",
       "      <td>0.337672</td>\n",
       "      <td>-0.254929</td>\n",
       "      <td>1.119666</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>-0.608657</td>\n",
       "      <td>-1.438188</td>\n",
       "      <td>-0.159281</td>\n",
       "      <td>0.723530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.347611</td>\n",
       "      <td>-0.452367</td>\n",
       "      <td>0.402648</td>\n",
       "      <td>0.467257</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>1.496493</td>\n",
       "      <td>-0.157088</td>\n",
       "      <td>-0.818421</td>\n",
       "      <td>1.591035</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.012103</td>\n",
       "      <td>0.366143</td>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.531323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>1.950344</td>\n",
       "      <td>-1.013829</td>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.422232</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           D         c         B         a\n",
       "0   0.109561 -2.134440  0.175040 -0.184678\n",
       "1  -0.848362 -1.357080  0.131141  0.420003\n",
       "2  -0.905888  1.129412  0.198811 -0.805069\n",
       "3   1.042945  0.770718  1.611422  0.844412\n",
       "4   0.689507  0.337672 -0.254929  1.119666\n",
       "..       ...       ...       ...       ...\n",
       "95 -0.608657 -1.438188 -0.159281  0.723530\n",
       "96  0.347611 -0.452367  0.402648  0.467257\n",
       "97  1.496493 -0.157088 -0.818421  1.591035\n",
       "98  0.012103  0.366143 -1.195636  0.531323\n",
       "99  1.950344 -1.013829 -0.266266 -1.422232\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_index(axis=1, ascending=False, key = lambda x: x.str.lower())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.columns = ['A','B','C','D']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "      <th>B</th>\n",
       "      <th>A</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-2.134440</td>\n",
       "      <td>0.109561</td>\n",
       "      <td>0.175040</td>\n",
       "      <td>-0.184678</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.357080</td>\n",
       "      <td>-0.848362</td>\n",
       "      <td>0.131141</td>\n",
       "      <td>0.420003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.129412</td>\n",
       "      <td>-0.905888</td>\n",
       "      <td>0.198811</td>\n",
       "      <td>-0.805069</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.770718</td>\n",
       "      <td>1.042945</td>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.844412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.337672</td>\n",
       "      <td>0.689507</td>\n",
       "      <td>-0.254929</td>\n",
       "      <td>1.119666</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>-1.438188</td>\n",
       "      <td>-0.608657</td>\n",
       "      <td>-0.159281</td>\n",
       "      <td>0.723530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>-0.452367</td>\n",
       "      <td>0.347611</td>\n",
       "      <td>0.402648</td>\n",
       "      <td>0.467257</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>-0.157088</td>\n",
       "      <td>1.496493</td>\n",
       "      <td>-0.818421</td>\n",
       "      <td>1.591035</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.366143</td>\n",
       "      <td>0.012103</td>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.531323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.013829</td>\n",
       "      <td>1.950344</td>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.422232</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           C         D         B         A\n",
       "0  -2.134440  0.109561  0.175040 -0.184678\n",
       "1  -1.357080 -0.848362  0.131141  0.420003\n",
       "2   1.129412 -0.905888  0.198811 -0.805069\n",
       "3   0.770718  1.042945  1.611422  0.844412\n",
       "4   0.337672  0.689507 -0.254929  1.119666\n",
       "..       ...       ...       ...       ...\n",
       "95 -1.438188 -0.608657 -0.159281  0.723530\n",
       "96 -0.452367  0.347611  0.402648  0.467257\n",
       "97 -0.157088  1.496493 -0.818421  1.591035\n",
       "98  0.366143  0.012103 -1.195636  0.531323\n",
       "99 -1.013829  1.950344 -0.266266 -1.422232\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by = 1, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>B</th>\n",
       "      <th>A</th>\n",
       "      <th>D</th>\n",
       "      <th>C</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.175040</td>\n",
       "      <td>-0.184678</td>\n",
       "      <td>0.109561</td>\n",
       "      <td>-2.134440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.131141</td>\n",
       "      <td>0.420003</td>\n",
       "      <td>-0.848362</td>\n",
       "      <td>-1.357080</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.198811</td>\n",
       "      <td>-0.805069</td>\n",
       "      <td>-0.905888</td>\n",
       "      <td>1.129412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.611422</td>\n",
       "      <td>0.844412</td>\n",
       "      <td>1.042945</td>\n",
       "      <td>0.770718</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.254929</td>\n",
       "      <td>1.119666</td>\n",
       "      <td>0.689507</td>\n",
       "      <td>0.337672</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>-0.159281</td>\n",
       "      <td>0.723530</td>\n",
       "      <td>-0.608657</td>\n",
       "      <td>-1.438188</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.402648</td>\n",
       "      <td>0.467257</td>\n",
       "      <td>0.347611</td>\n",
       "      <td>-0.452367</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>-0.818421</td>\n",
       "      <td>1.591035</td>\n",
       "      <td>1.496493</td>\n",
       "      <td>-0.157088</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>-1.195636</td>\n",
       "      <td>0.531323</td>\n",
       "      <td>0.012103</td>\n",
       "      <td>0.366143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-0.266266</td>\n",
       "      <td>-1.422232</td>\n",
       "      <td>1.950344</td>\n",
       "      <td>-1.013829</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           B         A         D         C\n",
       "0   0.175040 -0.184678  0.109561 -2.134440\n",
       "1   0.131141  0.420003 -0.848362 -1.357080\n",
       "2   0.198811 -0.805069 -0.905888  1.129412\n",
       "3   1.611422  0.844412  1.042945  0.770718\n",
       "4  -0.254929  1.119666  0.689507  0.337672\n",
       "..       ...       ...       ...       ...\n",
       "95 -0.159281  0.723530 -0.608657 -1.438188\n",
       "96  0.402648  0.467257  0.347611 -0.452367\n",
       "97 -0.818421  1.591035  1.496493 -0.157088\n",
       "98 -1.195636  0.531323  0.012103  0.366143\n",
       "99 -0.266266 -1.422232  1.950344 -1.013829\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by = 1, axis=1, key = lambda x: abs(x))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
